<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>心跳</title>
</head>
<style> 
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    html,body {
        width: 100%;
        height: 100%;
    }
    body {
        background-color: #fa74ac;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
    .heart {
        width: 200px;
        height: 200px;
        background-color: red;
        box-shadow: 0 0 30px red;
        position: relative;
        transform: rotate(45deg);
        animation: beat 1s alternate infinite;  /* 动画重复次数为无限循环*/
    }
    .heart::before {
        content: " ";
        width: 200px;
        height: 100px;
        left: 0;
        top: -99px;         /* 调整位置 */
        box-shadow: 0 0 30px red;
        border-radius: 100px 100px 0 0;
        position: absolute;
        background-color: red;
    }
    .heart::after {
        content: " ";
        width: 100px;
        height: 200px;
        box-shadow: 0 0 30px red;
        border-radius: 100px 0 0 100px;
        background-color: red;
        position: absolute;
        left: -99px;
        top: 0;
    }
    /* 动画 */
    @keyframes beat {
        0% {
            transform: rotate(45deg) scale(0.6);    /* 缩小到 0.6倍 */
        }
        100% {
            transform: rotate(45deg) scale(1.2);    /* 放大到 1.2倍 */
        }
    }

</style>

<body>
    <div class="heart"></div>
</body>

</html>